<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.2.0">


  <link rel="apple-touch-icon" sizes="180x180" href="https://www.wulihub.com.cn/gc/Wez0VG/images/apple-touch-icon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="https://www.wulihub.com.cn/gc/Wez0VG/images/favicon-32x32.png">
  <link rel="icon" type="image/png" sizes="16x16" href="https://www.wulihub.com.cn/gc/Wez0VG/images/favicon-16x16.png">
  <link rel="mask-icon" href="https://www.wulihub.com.cn/gc/Wez0VG/images/logo.svg" color="#222">

<link rel="stylesheet" href="https://www.wulihub.com.cn/gc/Wez0VG/css/main.css">



<link rel="stylesheet" href="https://npm.elemecdn.com/@fortawesome/fontawesome-free@6.1.1/css/all.min.css" integrity="sha256-DfWjNxDkM94fVBWx1H5BMMp0Zq7luBlV8QRcSES7s+0=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://npm.elemecdn.com/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"nobige.cn","root":"/","images":"https://www.wulihub.com.cn/gc/Wez0VG/images","scheme":"Gemini","darkmode":false,"version":"8.12.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"Searching...","empty":"We didn't find any results for the search: ${query}","hits_time":"${hits} results found in ${time} ms","hits":"${hits} results found"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/config.js"></script>

    <meta name="description" content="js取float型小数点后两位数的方法四舍五入 以下处理结果会四舍五入: 123var num &#x3D;3.1415926; num &#x3D; num.toFixed(2);&#x2F;&#x2F; 输出结果为 3.14">
<meta property="og:type" content="article">
<meta property="og:title" content="js  jquery 学习小笔记">
<meta property="og:url" content="https://nobige.cn/post/20170926-0902jqueryLearn/index.html">
<meta property="og:site_name" content="NoBige-JackCh3n">
<meta property="og:description" content="js取float型小数点后两位数的方法四舍五入 以下处理结果会四舍五入: 123var num &#x3D;3.1415926; num &#x3D; num.toFixed(2);&#x2F;&#x2F; 输出结果为 3.14">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20170926-0902jqueryLearn/xiao20170926202514.png">
<meta property="og:image" content="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20170926-0902jqueryLearn/xiao20170926202505.png">
<meta property="article:published_time" content="2017-09-26T14:18:43.000Z">
<meta property="article:modified_time" content="2024-11-07T02:59:06.170Z">
<meta property="article:author" content="JackCh3n">
<meta property="article:tag" content="jquery">
<meta property="article:tag" content="js">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20170926-0902jqueryLearn/xiao20170926202514.png">


<link rel="canonical" href="https://nobige.cn/post/20170926-0902jqueryLearn/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"en","comments":true,"permalink":"https://nobige.cn/post/20170926-0902jqueryLearn/","path":"post/20170926-0902jqueryLearn/","title":"js  jquery 学习小笔记"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>js  jquery 学习小笔记 | NoBige-JackCh3n</title>
  
  <script class="next-config" data-name="google_analytics" type="application/json">{"tracking_id":"UA-122817633-1","only_pageview":true}</script>
  <script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/analytics/google-analytics.js"></script>

  <script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/analytics/baidu-analytics.js"></script>
  <script async src="https://hm.baidu.com/hm.js?96741f92c07d010c0ddd1d02197893e2"></script>




  <noscript>
    <link rel="stylesheet" href="https://www.wulihub.com.cn/gc/Wez0VG/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">NoBige-JackCh3n</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">copy to my blog</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="home fa-fw"></i>Home</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="user fa-fw"></i>About</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="tags fa-fw"></i>Tags</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="th fa-fw"></i>Categories</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="archive fa-fw"></i>Archives</a></li><li class="menu-item menu-item-sitemap"><a href="/sitemap.xml" rel="section"><i class="sitemap fa-fw"></i>Sitemap</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>Search
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="Searching..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#js%E5%8F%96float%E5%9E%8B%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E4%B8%A4%E4%BD%8D%E6%95%B0%E7%9A%84%E6%96%B9%E6%B3%95"><span class="nav-number">1.</span> <span class="nav-text">js取float型小数点后两位数的方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Jquery%E4%B8%AD%E4%BD%BF%E7%94%A8setInterval%E5%92%8CsetTimeout%E7%9A%84%E6%96%B9%E6%B3%95"><span class="nav-number">2.</span> <span class="nav-text">Jquery中使用setInterval和setTimeout的方法</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#JavaScript-Date-%E5%AF%B9%E8%B1%A1"><span class="nav-number">3.</span> <span class="nav-text">JavaScript Date 对象_</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#JQuery%E8%8E%B7%E5%8F%96input-type-x3D-text%E4%B8%AD%E7%9A%84%E5%80%BC%E7%9A%84%E5%90%84%E7%A7%8D%E6%96%B9%E5%BC%8F"><span class="nav-number">4.</span> <span class="nav-text">JQuery获取input type&#x3D;text中的值的各种方式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#jQuery-%E8%BF%BD%E5%8A%A0%E5%85%83%E7%B4%A0%E7%9A%84%E6%96%B9%E6%B3%95%E5%A6%82append%E3%80%81prepend%E3%80%81before"><span class="nav-number">5.</span> <span class="nav-text">jQuery 追加元素的方法如append、prepend、before</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#jQuery-%E6%B8%85%E9%99%A4div%E5%86%85%E5%AE%B9"><span class="nav-number">6.</span> <span class="nav-text">jQuery 清除div内容</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Jquery%E6%B8%85%E9%99%A4style%E6%A0%B7%E5%BC%8F"><span class="nav-number">7.</span> <span class="nav-text">Jquery清除style样式</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Jquery-%E6%98%BE%E7%A4%BA%E9%9A%90%E8%97%8F%E5%86%85%E5%AE%B9"><span class="nav-number">8.</span> <span class="nav-text">Jquery 显示隐藏内容</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#jquery%E8%8E%B7%E5%8F%96textarea%E6%89%80%E8%BE%93%E5%85%A5%E7%9A%84%E8%A1%8C%E6%95%B0"><span class="nav-number">9.</span> <span class="nav-text">jquery获取textarea所输入的行数</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="JackCh3n"
      src="https://www.wulihub.com.cn/gc/Wez0VG/images/avatar.png">
  <p class="site-author-name" itemprop="name">JackCh3n</p>
  <div class="site-description" itemprop="description">Record the pit filling process with words</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">146</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">279</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/jackch3n" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;jackch3n" rel="noopener" target="_blank"><i class="github fa-fw"></i>GitHub</a>
      </span>
  </div>


  <div class="links-of-blogroll site-overview-item animated">
    <div class="links-of-blogroll-title"><i class="fa fa-globe fa-fw"></i>
      Links
    </div>
    <ul class="links-of-blogroll-list">
        <li class="links-of-blogroll-item">
          <a href="https://vercel.com/?f=nobige" title="https:&#x2F;&#x2F;vercel.com?f&#x3D;nobige" rel="noopener" target="_blank">vercel</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://www.jsdelivr.com/?f=nobige" title="https:&#x2F;&#x2F;www.jsdelivr.com?f&#x3D;nobige" rel="noopener" target="_blank">jsdelivr</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://www.upyun.com/?f=nobige" title="https:&#x2F;&#x2F;www.upyun.com?f&#x3D;nobige" rel="noopener" target="_blank">upyun</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://coding.net/?f=nobige" title="https:&#x2F;&#x2F;coding.net?f&#x3D;nobige" rel="noopener" target="_blank">coding</a>
        </li>
        <li class="links-of-blogroll-item">
          <a href="https://unsplash.com/?f=nobige" title="https:&#x2F;&#x2F;unsplash.com?f&#x3D;nobige" rel="noopener" target="_blank">unsplash</a>
        </li>
    </ul>
  </div>

        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="Back to top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="en">
    <link itemprop="mainEntityOfPage" href="https://nobige.cn/post/20170926-0902jqueryLearn/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://www.wulihub.com.cn/gc/Wez0VG/images/avatar.png">
      <meta itemprop="name" content="JackCh3n">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="NoBige-JackCh3n">
      <meta itemprop="description" content="Record the pit filling process with words">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="js  jquery 学习小笔记 | NoBige-JackCh3n">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          js  jquery 学习小笔记
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">Posted on</span>

      <time title="Created: 2017-09-26 22:18:43" itemprop="dateCreated datePublished" datetime="2017-09-26T22:18:43+08:00">2017-09-26</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">Edited on</span>
      <time title="Modified: 2024-11-07 10:59:06" itemprop="dateModified" datetime="2024-11-07T10:59:06+08:00">2024-11-07</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">In</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/js/" itemprop="url" rel="index"><span itemprop="name">js</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="Views" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="far fa-eye"></i>
      </span>
      <span class="post-meta-item-text">Views: </span>
      <span id="busuanzi_value_page_pv"></span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h2 id="js取float型小数点后两位数的方法"><a href="#js取float型小数点后两位数的方法" class="headerlink" title="js取float型小数点后两位数的方法"></a>js取float型小数点后两位数的方法</h2><p><strong>四舍五入</strong></p>
<p>以下处理结果会四舍五入:</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> num =<span class="number">3.1415926</span>; num = num.<span class="title function_">toFixed</span>(<span class="number">2</span>);</span><br><span class="line"><span class="comment">// 输出结果为 3.14</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<span id="more"></span>
<p><strong>不四舍五入</strong></p>
<p>以下处理结果不会四舍五入:</p>
<p>第一种，先把小数边整数：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="title class_">Math</span>.<span class="title function_">floor</span>(<span class="number">12.3456789</span> * <span class="number">100</span>) / <span class="number">100</span><span class="comment">// 输出结果为 12.34</span></span><br></pre></td></tr></table></figure>

<h2 id="Jquery中使用setInterval和setTimeout的方法"><a href="#Jquery中使用setInterval和setTimeout的方法" class="headerlink" title="Jquery中使用setInterval和setTimeout的方法"></a>Jquery中使用setInterval和setTimeout的方法</h2><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">setTimeout</span>(<span class="title function_">alert</span>(hello),<span class="number">3000</span>);<span class="comment">//毫秒 即1000=1</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">setInterval</span>(<span class="title function_">abc</span>(),<span class="number">3000</span>);<span class="comment">//调用可用“” 或不用</span></span><br></pre></td></tr></table></figure>

<p><strong>区别：</strong></p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">setTimeout</span>()</span><br></pre></td></tr></table></figure>

<p>从载入后延迟指定的时间去执行一个表达式或者是函数; <span style="color: #ff0000;">仅执行一次</span> ;和window.clearTimeout一起使用.</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">setInterval</span>()</span><br></pre></td></tr></table></figure>

<p>在执行时,它从载入页面后每隔指定的时间执行 一个表达式或者是函数;(功能类似于递归函数)；和window.clearInterval一起使用.</p>
<p><strong>补充说明：</strong></p>
<p>这两个方法都可以用来实现在一个固定 时间段之后去执行JavaScript。不过两者各有各的应用场景。</p>
<p><strong>方 法：</strong></p>
<p>实际上，setTimeout和 setInterval的语法相同。它们都有两个参数，一个是将要执行的代码字符串，还有一个是 以毫秒为单位的时间间隔，当过了那个时间段之后就将执行那段代码。</p>
<p>不过这两个函数还是有区别的， setInterval在执行完一次代码之后，经过了那个固定的时间间隔，它还会自动重复执行代 码，而setTimeout只执行一次那段代码。</p>
<h2 id="JavaScript-Date-对象"><a href="#JavaScript-Date-对象" class="headerlink" title="JavaScript Date 对象_"></a>JavaScript Date 对象_</h2><p><strong>创建 Date 对象的语法：</strong></p>
<p>var myDate&#x3D;new Date()</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="JQuery获取input-type-x3D-text中的值的各种方式"><a href="#JQuery获取input-type-x3D-text中的值的各种方式" class="headerlink" title="JQuery获取input type&#x3D;text中的值的各种方式"></a>JQuery获取input type&#x3D;text中的值的各种方式</h2><p>html</p>
<p><img src="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20170926-0902jqueryLearn/xiao20170926202514.png" alt="html"></p>
<p>js</p>
<p><img src="https://blog-static.nobige.cn/gh/JackCh3n/n0bige/post/20170926-0902jqueryLearn/xiao20170926202505.png" alt="js"></p>
<h2 id="jQuery-追加元素的方法如append、prepend、before"><a href="#jQuery-追加元素的方法如append、prepend、before" class="headerlink" title="jQuery 追加元素的方法如append、prepend、before"></a>jQuery 追加元素的方法如append、prepend、before</h2><p>**jQuery append() 方法 **</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jQuery <span class="title function_">append</span>() 方法在被选元素的结尾插入内容。<span class="title function_">append</span>(hello word.);</span><br></pre></td></tr></table></figure>
<p>**jQuery prepend() 方法 **</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">jQuery <span class="title function_">prepend</span>() 方法在被选元素的开头插入内容。<span class="title function_">prepend</span>(hello word.);</span><br></pre></td></tr></table></figure>

<p>**after() 和 before() 方法 **</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">jQuery <span class="title function_">after</span>() 方法在被选元素之后插入内容。<span class="title function_">after</span>(hello word.);</span><br><span class="line"></span><br><span class="line">jQuery <span class="title function_">before</span>() 方法在被选元素之前插入内容。<span class="title function_">before</span>(hello word.);</span><br></pre></td></tr></table></figure>

<h2 id="jQuery-清除div内容"><a href="#jQuery-清除div内容" class="headerlink" title="jQuery 清除div内容"></a>jQuery 清除div内容</h2><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$(#abc).<span class="title function_">empty</span>();</span><br></pre></td></tr></table></figure>

<h2 id="Jquery清除style样式"><a href="#Jquery清除style样式" class="headerlink" title="Jquery清除style样式"></a>Jquery清除style样式</h2><p>有些页面样式不规范，没有写在一个class里，</p>
<p>例如：</p>
<p>这种情况下清空style可以removeAttr()方法移除style属性来实现</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$(#show).<span class="title function_">removeAttr</span>(style); <span class="comment">//ie,ff均支持</span></span><br><span class="line"></span><br><span class="line">$(#show).<span class="title function_">attr</span>(style,);   <span class="comment">//ff支持，ie不支持</span></span><br></pre></td></tr></table></figure>


<h2 id="Jquery-显示隐藏内容"><a href="#Jquery-显示隐藏内容" class="headerlink" title="Jquery 显示隐藏内容"></a>Jquery 显示隐藏内容</h2><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="title function_">show</span>();<span class="comment">//显示</span></span><br><span class="line"></span><br><span class="line"><span class="title function_">hide</span>();<span class="comment">//隐藏</span></span><br></pre></td></tr></table></figure>



<h2 id="jquery获取textarea所输入的行数"><a href="#jquery获取textarea所输入的行数" class="headerlink" title="jquery获取textarea所输入的行数"></a>jquery获取textarea所输入的行数</h2><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$(#textarea).<span class="title function_">val</span>().<span class="title function_">split</span>(\n).<span class="property">length</span></span><br></pre></td></tr></table></figure>
    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/jquery/" rel="tag"># jquery</a>
              <a href="/tags/js/" rel="tag"># js</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/20170926-phpUniqueMark/" rel="prev" title="php 生成一个唯一 ID mark">
                  <i class="fa fa-chevron-left"></i> php 生成一个唯一 ID mark
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/20171020-Cleverbingtheprogrammer/" rel="next" title="api 机智的必应程序员bing每日壁纸">
                  api 机智的必应程序员bing每日壁纸 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    
  <div class="comments" id="disqus_thread">
    <noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript>
  </div>
  
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2024</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">JackCh3n</span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="Total Visitors">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="Total Views">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a>
  </div>
    <br/>Powerful CDN service provided by 
  <a target="_blank" rel="noopener" href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" style="border:none"><img src="https://www.wulihub.com.cn/gc/Wez0VG/images/upyun_logo.png" height="66" style="display: list-item;" alt="upyun"></a> 
  <a target="_blank" rel="noopener" href="https://www.jsdelivr.com" style="border:none"><img src="https://www.wulihub.com.cn/gc/Wez0VG/images/jsdelivr_logo.svg" height="50" style="display: list-item;" alt="JsDelivr"></a>
  <p>
  <br/><a target="_blank" rel="noopener" href="https://pages.github.com/?f=nobige">Github Pages</a>&nbsp;&nbsp;<a target="_blank" rel="noopener" href="https://vercel.com/?f=nobige">Vercel</a>&nbsp;&nbsp;<a target="_blank" rel="noopener" href="https://www.netlify.com/?f=nobige">Netlify</a>&nbsp;&nbsp;<a target="_blank" rel="noopener" href="https://coding.net/?f=nobige">coding</a>&nbsp;&nbsp;provides static publishing
  </p>

    </div>
  </footer>

  
  <script src="https://npm.elemecdn.com/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="https://www.wulihub.com.cn/gc/Wez0VG/js/comments.js"></script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/utils.js"></script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/motion.js"></script><script src="https://www.wulihub.com.cn/gc/Wez0VG/js/next-boot.js"></script>

  
<script src="https://npm.elemecdn.com/hexo-generator-searchdb@1.4.0/dist/search.js" integrity="sha256-vXZMYLEqsROAXkEw93GGIvaB2ab+QW6w3+1ahD9nXXA=" crossorigin="anonymous"></script>
<script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/search/local-search.js"></script>





  
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




<link rel="stylesheet" href="https://npm.elemecdn.com/disqusjs@1.3.0/dist/disqusjs.css" integrity="sha256-GxdCIOyfxQ1OBfS99qAIJDoGK1ADuBsxhMTqXG82fAY=" crossorigin="anonymous">

<script class="next-config" data-name="disqusjs" type="application/json">{"enable":true,"api":"https://duosuo.nobige.cn/","apikey":"Kmo9kPwsir7ppp8tGpeGROCmUtW8tdZBOdBVowPC67xVfTS5uV1wr6s4kckvP95m","shortname":"nobige","js":{"url":"https://npm.elemecdn.com/disqusjs@1.3.0/dist/disqus.js","integrity":"sha256-LVaMHPQ2zLqOc5rXSAfr4d1PIkEGNLyyUTDNPZmTtUw="}}</script>
<script src="https://www.wulihub.com.cn/gc/Wez0VG/js/third-party/comments/disqusjs.js"></script>

</body>
</html>
